<?php
	header('content-type:text/html;charset=utf-8'); 
	
	$dbdata = array();
	$i=0;
	$Order = $_POST["Order"];
	$dbName = "sqlsrv:Server=172.31.3.12,1433;Database=UFDATA_001_2017";   //这里是服务器IP地址和数据库名，端口不是默认的话记得改一下
	$dbUser = "user01";
	$dbPassword = "TDled2018@";
	$db = new PDO($dbName, $dbUser, $dbPassword);   //這裡是PDO鏈接方法
	/* $pdo =new pdo("mysql:host=127.0.0.1;port=3306;dbname=tddb;","root","tdled2018");
	$pdo->query("set character set 'utf8'");//读库 
	$pdo->query("set names 'utf8'");//写库  */
	$sql = 
	"select 
		distinct ds.cDefine28,ds.cinvCode ,ds.cBatch 
	from 
		DispatchLists as ds
	left join DispatchList d on d.DLID=ds.DLID
	where cDLCode='".$Order."'";
	
	$res = $db->query($sql);
	
	while ($row = $res->fetch()){
		$dbdata[$i][0]=$row['cDefine28'];
		$dbdata[$i][1]=$row['cBatch'];
		$dbdata[$i][2]=$row['cinvCode'];
		$i=$i+1;
	}
	
	//Print array in JSON format
	echo json_encode($dbdata);
	
?>

